﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sunny.UI;
namespace OtherDevice
{
    [Description("压力测试")]
    public partial class Form_压力测试 : Form_ControlBase
    {
        public Form_压力测试()
        {
            InitializeComponent();
        }
        Pressure_Base pressure;
        public override void FlushToDlg(object devicebase)
        {
            try
            {
                if (devicebase == null)
                    return;
                this.pressure = devicebase as Pressure_Base;
                this.Dock = DockStyle.Fill;
                this.Show();
            }
            catch (Exception)
            {

            }

        }        
       
        private void btn_BalanceValue_Click_1(object sender, EventArgs e)
        {
            int hight = 0;
            pressure.Get(ref hight);
            lbl_PressureValue.Text = $" {hight} g";

        }

        private void btn_Reset_Click(object sender, EventArgs e)
        {
            pressure.SetZore();

        }

        private void btn_SetCompareValue_Click(object sender, EventArgs e)
        {
            try
            {
                int n_Value = Convert.ToInt32(txt_PressureValue.Text);
                pressure.SetCompareValue(n_Value);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
